package com.fbd.apipassenger.controller;

import com.fbd.internalcommon.dto.VerificationCodeDTO;
import com.fbd.apipassenger.service.VerificationCodeService;
import com.fbd.internalcommon.dto.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class VerificationCodeController {

    @Autowired
    private VerificationCodeService verificationCodeService;
    @GetMapping("/verification-code")
    public ResponseResult verificationCode(@RequestBody VerificationCodeDTO verificationCodeDTO){
        String passengerPhone = verificationCodeDTO.getPassengerPhone();
        System.out.println("手机号：" + passengerPhone);
        return verificationCodeService.generatorCode(passengerPhone);
    }

    @PostMapping("verification-code-check")
    public ResponseResult checkVerificationCode(@RequestBody VerificationCodeDTO verificationCodeDTO){

        return verificationCodeService.checkCode(verificationCodeDTO);
    }
}
